﻿@model db.rbac_Resource

@{
    ViewBag.Title = "Update";
}

@section header
{
    <style type="text/css">
        .haveOperation {
        }

            .haveOperation span {
                float: left;
                width: 120px;
                display: block;
                text-align: right;
            }
    </style>
    <script type="text/javascript" charset="utf-8" src=@Url.Content("/uEditor/ueditor.config.js"+rui.configHelper.ctxKey)></script>
    <script type="text/javascript" charset="utf-8" src=@Url.Content("/uEditor/ueditor.all.min.js"+rui.configHelper.ctxKey)></script>
    <script type="text/javascript" charset="utf-8" src=@Url.Content("/uEditor/lang/zh-cn/zh-cn.js"+rui.configHelper.ctxKey)></script>
    <script type="text/javascript">
        //保存时获取值
        function saveBefore() {
            $(".uEditorProxy").val(ue.getContent());
            return "";
        }
        //保存后刷新列表数据
        function saveAfter() {
            refleshData(true);
        }
        var ue;
        $(document).ready(function () {
            //实例化编辑器
            ue = UE.getEditor('uEditor');

            //修改时获取以前的值
            ue.ready(function () {
                ue.setContent($(".uEditorProxy").val());
            });

            $(".haveOperation .ruiCheckBox").change(function () {
                var resourceCode = $(".resourceCode").val();
                var opCode = $(this).val();
                var tag = $(this).is(':checked');

                ajaxPost("/admin/rbac_ResourceOp/InsertFromCheck", {
                    resourceCode: resourceCode,
                    opCode: opCode,
                    tag: tag
                }, function (data) {
                    showJsonResult(data, function () {
                        refleshData(true);
                    });
                });
            });
        });
    </script>
}

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)

<div class="dialog">
    <div class="editor-label hide">
        @Html.LabelFor(model => model.rowNum)
    </div>
    <div class="editor-field hide">
        @Html.EditorFor(model => model.rowNum)
        @Html.ValidationMessageFor(model => model.rowNum)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.resourceCode)
    </div>
    <div class="editor-field read">
        @Html.TextBoxFor(model => model.resourceCode, new { @class = "resourceCode" })
        @Html.ValidationMessageFor(model => model.resourceCode)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.resourceName)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.resourceName)
        @Html.ValidationMessageFor(model => model.resourceName)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.moduleCode)
    </div>
    <div class="editor-field">
        @Html.DropDownListFor(a => a.moduleCode, db.bll.rbac_Module.bindDdl(), new { @class = "moduleCode" })
        @Html.ValidationMessageFor(model => model.moduleCode)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.showOrder)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.showOrder)
        @Html.ValidationMessageFor(model => model.showOrder)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.resourceUrl)
    </div>
    <div class="editor-field three">
        @Html.EditorFor(model => model.resourceUrl)
        @Html.ValidationMessageFor(model => model.resourceUrl)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.opControl)
    </div>
    <div class="editor-field">
        @Html.DropDownListFor(a => a.opControl, rui.listHelper.bind是否())
        @Html.ValidationMessageFor(model => model.opControl)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.dataControl)
    </div>
    <div class="editor-field">
        @Html.DropDownListFor(a => a.dataControl, rui.listHelper.bind是否())
        @Html.ValidationMessageFor(model => model.dataControl)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.pageWidth)
    </div>
    <div class="editor-field">
        @Html.EditorFor(a => a.pageWidth)
        @Html.ValidationMessageFor(model => model.pageWidth)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.isShow)
    </div>
    <div class="editor-field">
        @Html.DropDownListFor(a => a.isShow, rui.listHelper.bind是否())
        @Html.ValidationMessageFor(model => model.pageWidth)
    </div>

    <div class="display-label">
        @Html.DisplayNameFor(model => model.haveOperations)
    </div>
    <div class="display-field three">
        @Html.DisplayFor(model => model.haveOperations)
    </div>

    <fieldset>
        <legend>
            通用权限
        </legend>
        <div class="haveOperation">
            @Html.CheckBoxListFor(model => model.haveOperations, Model.operationCodeDdlList)
            @Html.ValidationMessageFor(model => model.haveOperations)
        </div>
    </fieldset>

    <fieldset>
        <legend>
            资源权限
        </legend>
        <div>
            @Html.Action("SelectPartial", "rbac_ResourceOp", new { upCode = Model.resourceCode, opMode = "Update" })
        </div>
    </fieldset>

    <p class="button">
        <a class="billSave opSave">保存</a>
        @Html.ActionLink("新增", "Insert", "rbac_ResourceOp", new { resourceCode = Model.resourceCode }, new { @class = "billOp opInsert", data_reflesh = "true" })
        <a class="opClose">关闭</a>
    </p>

    <fieldset>
        <legend>
            @Html.LabelFor(model => model.remark)
        </legend>
        <div>
            @Html.HiddenFor(model => model.remark, new { @class = "uEditorProxy" })
            <script id="uEditor" type="text/plain" style="width: 100%; height: 200px;">
            </script>
        </div>
    </fieldset>
</div>
}

<fieldset>
    <legend>相关附件</legend>
    @{
        var routeValue = new
        {
            attachResourceCode = "rbac_Resource",
            attachKeyCode = Model.resourceCode,
            attachOpMode = "Update"
        };
    }
    @Html.Action("SelectPartial", "sys_BillAttach", routeValue)
</fieldset>
